import {subType} from '@/redux/interface/index'
import {produce} from "immer";
import * as types from '@/redux/constant'

const initState:subType ={
   subOptions:[],
   userOptions:[],
   RAMOptions:[],
   subAllOptions:[],
}
const subData = (preState: subType = initState, action: any) => produce(preState,draftState=>{
   let {type,data} = action
   switch(type){
          case types.SET_SUB_OPTINS:
             draftState.subOptions = [...data]
             break;

          case types.SET_USER_OPTINS:
              draftState.userOptions = [...data]
              break;

          case types.SET_RAM_OPTINS:
             draftState.RAMOptions = [...data]
             break;

          case types.SET_SUB_ALL_OPTINS:
             draftState.subAllOptions = [...data]
             break;


          default:
              return draftState;
        }
})

export default subData
